public class ModifyString {
    //替换所有的问号
    public String code(String ss) {
        char[] s = ss.toCharArray();

        for (int i = 0; i < s.length; i++){
            if (s[i] == '?'){
                for (char j = 'a'; j <= 'z'; j++){
                    if ((i == 0 || j != s[i - 1]) && (i == s.length - 1 || j != s[i + 1])){
                        s[i] = j;
                        break;
                    }
                }
            }
        }

        return String.valueOf(s);
    }
}
